package com.getee.tianchaohongyu.kopier

import com.getee.tianchaohongyu.kopier.parser.PropertyParser


/**
 * 复制器
 * created zpf on 2019/2/18 0018
 */
open class Kopier {

    /**
     * 解析字符序列
     * @param charSequence 字符序列
     */
    open fun parse(charSequence: CharSequence): List<NodeData> {
        val iterator = charSequence.chars().iterator()
        return parse(iterator)
    }

    /**
     * 解析字符码迭代器
     * @param iterator 迭代器
     */
    open fun parse(iterator: Iterator<Int>): List<NodeData> {
        val root = NodeData("ROOT")
        root.root = root
        root.parent = root
        PropertyParser.parse(root, iterator)
        return root.properties
    }
}